var columns = [
    {field: 'id',title: '序号',
        formatter:function(value, row, index){
            return index + 1 + (row.pageNumber-1)*row.pageSize;
        }
    },
    //{field: 'id',title: '序号'},
    {field: 'detailId',title:'订单详情ID'},
    {field: 'tradeNo',title: '交易号'},
    {field: 'tradeType',title: '交易类型'},
    {field: 'prepayId',title: '预支付号'},
    // {field: 'userId',title: '购买人ID'},
    {field: 'trueName',title: '购买人'},
    {field: 'lessonName',title: '课程名称'},
    {field: 'orderDate',title: '下单时间'},
    {field: 'status',title: '订单状态',class:'col-width-state',
        formatter: function (value, row) {
            return pubForm.getOrderStatus(row);
        }
    },{field: 'price',title: '单价'},
    {field: 'quantity',title: '数量'},
    {field: 'amounts',title: '总价'},
    {field:'orderAmount',title:'订单价格'},
    {field: 'operator',title: '操作',
        formatter: function (value, row, index) {
            return pubOptBtn.getOptBtnCustom('order',menu,row.id,row.detailId);
        }
    }];

var order={
    init:function() {
        var tradeNo = $("#tradeNo").val();
        var userId = $("#userId").val();
        var status = $("#status").val();
        var prepayId = $("#prepayId").val();
        var tradeType = $("#tradeType").val();
        var startTime = $("#startTime").val();
        var endTime = $("#endTime").val();
        var parmsObj = {};
        parmsObj.tradeNo=tradeNo;
        parmsObj.userId=userId;
        parmsObj.status=status;
        parmsObj.prepayId=prepayId;
        parmsObj.tradeType=tradeType;
        parmsObj.startTime=startTime;
        parmsObj.endTime=endTime;
        console.log("aaaaaaaaaaaaaaa");
        pubForm.getBootTable("#tableOrderList","/base/order/queryOrderList?tradeNo="+tradeNo+"&userId="+userId+"&status="+status+"&prepayId="+prepayId+"&tradeType="+tradeType+"&startTime="+startTime+"&endTime="+endTime,null,parmsObj);
    },
    refreshTabel:function () {
        var size = $(".page-size").text();
        var tradeNo = $("#tradeNo").val();
        var userId = $("#userId").val();
        var status = $("#status").val();
        var prepayId = $("#prepayId").val();
        var tradeType = $("#tradeType").val();
        var startTime = $("#startTime").val();
        var endTime = $("#endTime").val();
        var parmsObj = {};
        parmsObj.tradeNo=tradeNo;
        parmsObj.userId=userId;
        parmsObj.status=status;
        parmsObj.prepayId=prepayId;
        parmsObj.tradeType=tradeType;
        parmsObj.startTime=startTime;
        parmsObj.endTime=endTime;
        var opt = {
            url: application.contextPath + "/base/order/queryOrderList",
            query: {
                size: size,
                page: 1,
                tradeNo:tradeNo,
                userId:userId,
                status:status,
                prepayId:prepayId,
                tradeType:tradeType,
                startTime:startTime,
                endTime:endTime
            },
            silent: true
        };
        $("#tableOrderList").bootstrapTable('refreshOptions',opt);
    },
    showSOrderPage:function(orderId){
        loadUtil = new Load($);
        loadUtil.load({
            container:'#homeContent',
            url: application.contextPath+"/base/order/showSOrderPage?orderId="+orderId.split(",")[0]+"&detailId="+orderId.split(",")[1]
        });
    },
    queryOrderByMap:function () {
        var size = $(".page-size").text();
        var tradeNo = $("#tradeNo").val();
        var userId = $("#userId").val();
        var status = $("#status").val();
        var prepayId = $("#prepayId").val();
        var tradeType = $("#tradeType").val();
        var startTime = $("#startTime").val();
        var endTime = $("#endTime").val();

        var size = $(".page-size").text();
        var opt = {
            url: application.contextPath + "/base/order/queryOrderListS?tradeNo="+tradeNo+"&userId="+userId+"&status="+status+"&prepayId="+prepayId+"&tradeType="+tradeType+"&startTime="+startTime+"&endTime="+endTime,
            query: {
                size: size,
                page: 1
            },
            silent: true
        };
        $('#tableOrderList').bootstrapTable('refreshOptions', opt);

    }
};

$(document).ready(function(){
    order.init();
});